<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<title>地址管理 - {$site_name}</title>
	<meta name="keywords" content="{$site_seo_keywords}" />
	<meta name="description" content="{$site_seo_description}">
	<tc_include file="Public:head" />	
</head>
<body class="body-white" id="top">
	<!---头部开始--->
	<tc_include file="Public:header"/>
	<!---头部结束--->

		<div class="k-row user-center-main">
                <div class="row">
                    <div class="c-left fl">
	                    <tc_include file="Public:usernav"/>
                    </div>
                    <div class="c-right fr">
                           <div class="tabs">
                               <ul class="nav nav-tabs">
                                   <li class="active"><a href="#" data-toggle="tab">地址管理</a></li>
                               </ul>							  															 
							   <a class="add-address" href="javascript:void(0);" onclick="addresssBox('add')">+添加地址</a>
                               <div class="tab-content">
                                   <div class="address-list">
									
									<foreach name="address_list" item="v"  key="k">
										<div class="address-info" data-id="{$v[address_id]}">
											
											<a href="javascript:;" onclick="layerPrompt('{$v[address_id]}')" class="del-address"><i class="fa fa-trash"></i></a>
											<if condition="$v['is_default'] eq 1">
											<span class="default">默认地址</span>
											<else />
											<a class="s-default" href="{:U('user/profile/default_address',array('id'=>$v['address_id']))}">设为默认地址</a>
											</if>		
											<p><span>收货人：</span>{$v[consignee]}</p>
											<p><span>联系电话：</span>{$v[mobile]}</p>
											<p><span>收货地址：</span>{$regionList[$v[province]]}{$regionList[$v[city]]}{$regionList[$v[district]]}{$regionList[$v[twon]]}{$v[address]}</p>
											<a href="javascript:void(0);" class="edit" onclick="addresssBox('{$v[address_id]}')">编辑</a>
										</div>	               
									</foreach>
									
									</div>
                               </div>							
                           </div>
                    </div>
                </div>

		

	</div>
	<!-- /container -->
	<tc_include file="Public:footer" />
	<tc_include file="Public:scripts" />
	<script type="text/javascript">
	function layerPrompt(id){		
		layer.confirm('确定要删除吗？', {
		  btn: ['确定','取消'] //按钮
		}, function(){
			del_address(id);
			layer.closeAll('page');
			layer.msg(null);
		}, function(){
		  
		});
	}
	</script>
	<script type="text/javascript">
		//弹出添加编辑收货地址
		function addresssBox(_type){			
			var _html = '/index.php?g=User&m=profile&a=address_info&type='+ _type;							
			layer.open({
				type: 2,
				title: '收货信息',
				shadeClose: true,
				shade: 0.8,
				area: ['800px', '520px'],
				content: _html,
			});							 
		}
	</script>
	<script type="text/javascript">
		function del_address(id)
		{
			$.ajax({
				url:"/index.php?g=User&m=address&a=del_address&id="+id,
				success: function(data){
					parent.location.reload();
				}
			});	  	  
		}
	</script>
</body>
</html>